<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>document</title>
    <link rel="stylesheet" href="../model/jsFn.css">
    <link rel="stylesheet" href="../model/element.css">
</head>
<body>
<div class="catalog">
    <h1>目录</h1>
    <ul>
        <li>
            <p><a href="#profile">document</a></p>
            <ul>
                <li><p><a href="#jsFn_open">open() ---------- 打开新页面</a></p></li>
                <li><p><a href="#jsFn_dialog">dialog()  ---------- 打开dialog窗口</a></p></li>
                <li><p><a href="#jsFn_popup">popup()  ---------- 打开popupWindow</a></p></li>
                <li><p><a href="#jsFn_$">$() ---------- 寻找当前页面的id</a></p></li>
                <li><p><a href="#jsFn_finish">finish() ---------- 关闭页面</a></p></li>
                <li><p><a href="#jsFn_next">next()  ---------- 页面关闭时,并且返回数据给上一个页面</a></p></li>
                <li><p><a href="#jsFn_getParent">getParent()  ---------- 获得父类的document</a></p></li>

                <li><p><a href="#jsFn_phone">phone()  ---------- 快捷打开拨打电话的页面</a></p></li>
                <li><p><a href="#jsFn_arguments">arguments()  ---------- 获得上一个页面传过来的数据</a></p></li>
                <li><p><a href="#jsFn_element">element</a></p></li>
                <li><p><a href="#jsFn_camera">camera()  ---------- 打开相机</a></p></li>
                <li><p><a href="#jsFn_album">album() -----------打开相册</a></p></li>
                <li><p><a href="#jsFn_video">video() -----------打开摄像机</a></p></li>
            </ul>
        </li>
        <li>
            <p><a href="#keyword">document.keyword</a></p>
            <ul>
                <li><p><a href="#jsFn_keyword.show">keyword.show</a></p></li>
                <li><p><a href="#jsFn_keyword.hide">keyword.hide</a></p></li>
                <li><p><a href="#jsFn_keyword.resize">keyword.resize</a></p></li>
                <li><p><a href="#jsFn_keyword.nothing">keyword.nothing</a></p></li>
            </ul>
            <p><a href="#page">document.page</a></p>
            <p><a href="">document.onBack</a></p>
            <p><a href="">document.onResume</a></p>
            <p><a href="">document.onPause</a></p>
            <p><a href="">document.onDestroy</a></p>
        </li>
    </ul>
</div>
<div id="profile">
    <h2>对象简介:document</h2>
    <p>根标签plain|coordinator包含起来的整个页面的上下文,和android里的activity ,html5里的window相对应;</p>
    <p>document.href:当前页面的路径</p>
    <p>document.isFinish:当前页面是否关闭 -------(有bug)</p>
</div>


<!--对象的某一个方法-->
<div class="jsFnModel" id="jsFn_open">
    <h3>open:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.open(url,[arguments]) ->promise</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>跳转页面,若已有相同路径页面被打开,则关闭之前的页面,打开现在的页面</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.2</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>url</p>
                <p>&nbsp;string&nbsp;</p>
                <p>跳转到指定的路径,若路径不存在,则跳转到系统默认的错误页面</p>
            </li>
            <li>
                <p>arguments</p>
                <p>&nbsp;object&nbsp;</p>
                <p>传递给下一个页面的参数,默认为{}</p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>promise</p>
        <p>res(object):后一个页面关闭时返回给前一个页面的数据</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                //a.xml
                document.open('b.xml').then(res=>{
                    console.log(res.name);
                });
                document.open('b.xml',{userId:12}).then(res=>{
                    console.log(res.name);
                });
                //b.xml
                console.log(document.arguments.userId);
                document.next({name:'张三'});document.finish();
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_dialog">
    <h3>dialog:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.dialog(url,[arguments]) ->promise</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>打开一个dialog窗口</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.2</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>url</p>
                <p>&nbsp;string&nbsp;</p>
                <p>跳转到指定的路径,若路径不存在,则跳转到系统默认的错误页面</p>
            </li>
            <li>
                <p>arguments</p>
                <p>&nbsp;object&nbsp;</p>
                <p>传递给下一个页面的参数,默认为{}</p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>promise</p>
        <p>res(object):后一个页面关闭时返回给前一个页面的数据</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                //a.xml
                document.dialog('b.xml').then(res=>{
                    console.log(res.name);
                });
                document.dialog('b.xml',{userId:12}).then(res=>{
                    console.log(res.name);
                });
                //b.xml
                console.log(document.arguments.userId);
                document.next({name:'张三'});document.finish();
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_popup">
    <h3>popup:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.popup(url,viewId,[arguments]);</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>打开一个附着在指定view的小窗口</p>
    </div>
    <div style="background: #c3c363" class="version">
        <p>稳定性;1 - 不稳定的</p>
        <p>新增于:v0.0.2</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>url</p>
                <p>&nbsp;string&nbsp;</p>
                <p>窗口路径</p>
            </li>
            <li>
                <p>viewId</p>
                <p>&nbsp;float&nbsp;</p>
                <p>指定一个布局的id,让小窗口附着在上面</p>
            </li>
            <li>
                <p>argument</p>
                <p>&nbsp;object&nbsp;</p>
                <p><a href="#jsFn_open">同document.open()</a></p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>promise</p>
        <p>res(object),popupWindow关闭时的返回值;</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <xmp>
                <text id="text1">
                    <lp>lptext</lp>
                </text>
                let viewId = document.$('text1').lp.getView();
                document.popup('popupWindow.xml',viewId);
                document.popup('popupWindow.xml',viewId,{name:'张三'});
            </xmp>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_$">
    <h3>$:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.$(id) -> view</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>通过id寻找当前上下文里的view</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.0</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>id</p>
                <p>&nbsp;string&nbsp;</p>
                <p>控件的id属性对应的值</p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>view</p>
        <p>返回一个控件view,参考 <a href="../view/index.html">< view ></a></p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <xmp>
                <text id="test1">
                    <lp>test</lp>
                </text>
                let view = document.$('test1');
                let lpText = view.get('lp');
                console.log(lpText);
            </xmp>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_finish">
    <h3>finish:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.finish([option]) ->null</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>关闭页面</p>
    </div>
    <div class="version" style="background: #c3c363">
        <p>稳定性;1 - 不稳定的</p>
        <p>新增于:v0.0.0</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>options</p>
                <p>&nbsp;string&nbsp;</p>
                <p>若为other,关闭除当前页面以外的其他页面<br/>
                    若为all,关闭所有页面<br/>
                    若为home,关闭除第一页以外的所有页面 <br/>
                    若为空,则关闭当前页面
                </p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>null</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                document.finish();
                console.log('关闭当前页');
                document.finish('other');
                console.log('关闭除当前页面以外的其他页面');
                document.finish('all');
                console.log('关闭所有页面');
                document.finish('home');
                console.log('关闭所有页面,只留下第一个页面');
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_next">
    <h3>next:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.next([option]) ->null</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>关闭页面,并且返回数据给上一个页面</p>
    </div>
    <div class="version" style="background: #c3c363">
        <p>稳定性;1 - 不稳定的</p>
        <p>新增于:v0.0.1</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>options</p>
                <p>&nbsp;obj&nbsp;</p>
                <p>返回给上一个页面的数据,不能传递function</p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>null</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                //a.xml
                document.open('b.xml').then(res=>{
                    console.log(res.name);
                });
                //b.xml
                document.next({name:'张三'});
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_getParent">
    <h3>getParent:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.getParent() -> document</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>获得父布局的上下文</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.0</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <p>无</p>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>document</p>
        <p>返回父布局的上下文,若没有父布局则返回false</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                if(document.getParent()){
                    document.getParent().$('parentFooterText').set({lp:{p:'改变父布局底部text的文字'});
                }
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_phone">
    <h3>phone:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.phone(phone) ->promise</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>拨打电话</p>
    </div>
    <div class="version" style="background: #c3c363;">
        <p>稳定性;1 - 不稳定的</p>
        <p>新增于:v0.0.0</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>phone</p>
                <p>&nbsp;string&nbsp;</p>
                <p>要快捷拨打的电话号码</p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>promise</p>
        <p>res(object):拨打成功信息,rej():拨打失败</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                document.phone('13412345678').then(res=>{
                    console.log('拨打成功');
                }).catch(e){
                    console.log('拨打电话失败');
                };
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_arguments">
    <h3>arguments:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.argument() ->object</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>获得上一个页面传过来的数据</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.2</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>无</p>
                <p>&nbsp;无&nbsp;</p>
                <p>无</p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>object</p>
        <p>上一个页面传过来的数据</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                let data = document.arguments();
                console.log(data.name);
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_element">
    <h3>element:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.element([element]) ->view|xml</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>生成一个view,或者返回当前布局xml</p>
    </div>
    <div class="version" style="background: #c3c363">
        <p>稳定性;1 - 不稳定的</p>
        <p>新增于:v0.0.2</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>element</p>
                <p>&nbsp;string&nbsp;</p>
                <p>字符串形式的控件元素</p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>view|xml</p>
        <p>view:没有布局的控件对象,参见 <a href="../view/index.html">< view ></a><br/>
            xml:若没有参数,则返回布局的xml
        </p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <xmp>
                //view
                let element = "<text id=\"test_createElement\"><lp>测试数据</lp></text>";
                let view = document.element(element);
                document.append(view);

                //xml
                let xml = document.element();
                console.log(xml);
            </xmp>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_camera">
    <h3>camera:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.camera() ->promise</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>打开相机拍照,获得照片</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.2</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <p>无</p>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>promise</p>
        <p>res(path):图片的绝对路径;rej(e):打开相机失败,权限问题</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                document.camera().then(res=>{
                    console.log('生成的相片路径',res);
                }).catch(e=>{
                    console.log('打开相机失败');
                });
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_album">
    <h3>album:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.album([options]) ->promise</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>打开相册,获得图片或则视频</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.2</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <ul>
            <li>
                <p>options.column</p>
                <p>&nbsp;int&nbsp;</p>
                <p>列表有几列,默认2</p>
            </li>
            <li>
                <p>options.select</p>
                <p>&nbsp;int&nbsp;</p>
                <p>最多可选图片,默认9</p>
            </li>
            <li>
                <p>options.title</p>
                <p>&nbsp;string&nbsp;</p>
                <p>标题,默认'相册'</p>
            </li>
            <li>
                <p>options.clear</p>
                <p>&nbsp;true|false&nbsp;</p>
                <p>是否清空之前的选择记录</p>
            </li>
        </ul>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>promise</p>
        <p>res(list< path >):图片的绝对路径数组;rej(e):打开相机失败,权限问题</path>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                document.album({title:'asfd',column:3}).then(res=>{
                    console.log('生成的相片路径',res);
                }).catch(e=>{
                    console.log('打开相机失败');
                });
                document.album().then(res=>{
                    console.log('生成的相片路径',res);
                }).catch(e=>{
                    console.log('打开相机失败');
                });
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_video">
    <h3>video:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.video() ->promise</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>打开摄像机拍照,获得视频</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.2</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <p>无</p>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>promise</p>
        <p>res(path):视频的绝对路径;rej(e):打开摄像机失败,权限问题</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                document.video().then(res=>{
                    console.log('生成的视频路径',res);
                }).catch(e=>{
                    console.log('打开摄像机失败');
                });
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>


<div id="keyword">
    <h2>对象简介:keyword</h2>
    <p>页面的软键盘控制器</p>
</div>
<div class="jsFnModel" id="jsFn_keyword.show">
    <h3>show:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.keyword.show() -> document.keyword</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>软键盘打开</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.0</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <p>无</p>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>keyword</p>
        <p>返回自己</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                document.keyword.show();
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_keyword.hide">
    <h3>hide:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.keyword.hide() -> document.keyword</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>隐藏软键盘</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.0</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <p>无</p>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>document.keyword</p>
        <p>返回本身</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                document.keyword.hide()
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_keyword.resize">
    <h3>resize:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.keyword.resize() -> document.keyword</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>软件盘占布局</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.0</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <p>无</p>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>document.keyword</p>
        <p>返回本身</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
               document.keyword.resize().show();
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>
<div class="jsFnModel" id="jsFn_keyword.nothing">
    <h3>nothing:</h3>
    <div class="shape">
        <h3>函数使用样式</h3>
        <p>document.keyword.nothing() ->document.keyword</p>
    </div>
    <div class="profile">
        <h3>函数功能简介</h3>
        <p>软键盘不占布局</p>
    </div>
    <div class="version">
        <p>稳定性;2 - 稳定的</p>
        <p>新增于:v0.0.0</p>
    </div>
    <div class="params">
        <h3>参数列表:</h3>
        <p>无</p>
    </div>
    <div class="res">
        <h3>返回值:</h3>
        <p>document.keyword</p>
        <p>返回本身</p>
    </div>
    <div class="code">
        <h3>例子</h3>
        <pre>
            <code>
                document.keyword.nothing.show();
            </code>
        </pre>
    </div>
    <div class="error">
        <h3>抛出错误</h3>
    </div>
</div>

<div id="page">
    <h2>对象简介:page</h2>
    <p>页面路径</p>
</div>
<div id="onBack">
    <h2>对象简介:onBack</h2>
    <p>点击返回按钮时执行的方法</p>
</div>
<div id="onPause">
    <h2>对象简介:onPause</h2>
    <p>页面不可见,暂停时执行的方法</p>
</div>
<div id="onResume">
    <h2>对象简介:onResume</h2>
    <p>页面可见时执行的方法</p>
</div>
<div id="onDestroy">
    <h2>对象简介:onDestroy</h2>
    <p>页面销毁时执行的方法</p>
</div>
<div class="author">
    <p>by-草草</p>
</div>
</body>
</html>